package com.trs.dao;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.trs.entry.ServerInfo;

public interface ServerInfoDao extends JpaRepository<ServerInfo, Integer> {

	List<ServerInfo> findByType(Integer type);

	List<ServerInfo> findByTypeAndChatoldNotAndChatoldNotNullOrderByArea(Integer type, String string);

	List<ServerInfo> findByTypeAndIssendDDAndStatusAndRealipNotAndRealipNotNullOrderByArea(Integer type, Integer issenddd, Integer status, String realip);

	@Modifying
	@Transactional
	@Query(nativeQuery = true, value = "update cqserver set status=?,statustime=now() where id=?")
	Integer updateStatusById(Integer status, Integer id);

}
